<?php
echo CHtml::link(CHtml::image(Yii::app()->baseUrl . '/assets/backend/images/select_picture.png', '', array('style' => 'verial-align: bottom; padding: 0; margin: 0px;')),
    array('media/selectMediaFile'), array('id' => $element_id));
?>
<link rel="stylesheet" href="<?php echo Yii::app()->baseUrl; ?>/assets/backend/nyroModal/styles/nyroModal.css" type="text/css" media="screen" />
<script type="text/javascript" src="<?php echo Yii::app()->baseUrl; ?>/assets/backend/nyroModal/js/jquery.nyroModal-1.5.5.pack.js"></script>
<script type="text/javascript">
    $(function() {
        $('#<?php echo $element_id; ?>').nyroModal({
            bgColor: '#cccccc',
            minWidth: 600,
            minHeight: 400,
            height: 400,
            padding: 0,
            title: 'Please select a image',
            ajax: {
                type: "POST",
                url: "<?php echo Yii::app()->createUrl('media/selectMediaFile'); ?>",
                data: "type=<?php echo $media_type; ?>&element_id=<?php echo $update_element_id; ?>",
                success: function(msg){
                    alert( "Data Saved: " + msg );
                }
            }
        });
    });
</script>